package eiisan.config.aop.exception.annotation;

import eiisan.constant.errors.code.ErrorCode;

import java.lang.annotation.*;

/**
 * 异常处理,截获所有异常,输出日志,然后返回统一服务异常<br>
 * 本注解无法处理finally块,请在方法体内处理finally<br>
 * 等同于:
 *
 * <pre>
 *
 * method XXX() {
 * 	try {
 * 	} catch (Exception e) {
 * 		log.error("[XXX]", e);
 * 		throw new ServiceException(ErrorCode.USER_SERVICE_ERROR);
 * 	}
 * }
 * </pre>
 *
 */
@Documented
@Target({ ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface CatchAndThrow {

	/**
	 * 错误信息码
	 */
	ErrorCode errorCode();

}
